<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;

class GoodsSearchController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function getIndex(Request $request)
    {  //获取搜索关键词
        $search = $request -> input('goodssearch','');
        //根据关键词搜索数据库里面的商品信息
        $data = DB::table('tbl_goods') -> where('goodsname','like','%'.$search.'%') ->paginate(12);

        return view('home.goods.goodssearch',['data'=>$data,'request'=>$request->all()]);
    }


    

    
}
